package cn.iocoder.yudao.module.shop.dal.mysql.giftcardrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.giftcardrecord.ShopGiftCardRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.giftcardrecord.vo.*;

/**
 * 礼品卡绑定记录 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopGiftCardRecordMapper extends BaseMapperX<ShopGiftCardRecordDO> {

    default PageResult<ShopGiftCardRecordDO> selectPage(ShopGiftCardRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopGiftCardRecordDO>()
                .eqIfPresent(ShopGiftCardRecordDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(ShopGiftCardRecordDO::getTenantId, reqVO.getTenantId())
                .likeIfPresent(ShopGiftCardRecordDO::getNickname, reqVO.getNickname())
                .eqIfPresent(ShopGiftCardRecordDO::getMobile, reqVO.getMobile())
                .betweenIfPresent(ShopGiftCardRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopGiftCardRecordDO::getId));
    }

    default List<ShopGiftCardRecordDO> selectList(ShopGiftCardRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopGiftCardRecordDO>()
                .eqIfPresent(ShopGiftCardRecordDO::getMemberId, reqVO.getMemberId())
                .likeIfPresent(ShopGiftCardRecordDO::getNickname, reqVO.getNickname())
                .eqIfPresent(ShopGiftCardRecordDO::getMobile, reqVO.getMobile())
                .betweenIfPresent(ShopGiftCardRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopGiftCardRecordDO::getId));
    }

}
